package com.mdb.open.epay.service.epay;

import com.baomidou.dynamic.datasource.annotation.DS;
import com.baomidou.mybatisplus.core.conditions.query.LambdaQueryWrapper;
import com.mdb.bc.database.mybatisplus.SuperService;
import com.mdb.open.epay.common.MdbDataSource;
import com.mdb.open.epay.domain.po.epay.QpSign;
import com.mdb.open.epay.mapper.epay.QpSignMapper;
import org.springframework.stereotype.Service;

/**
 * 类描述：
 * 快捷签约表 服务类
 *
 * @author liuyi
 * @date 2019-11-14
 */
@Service
@DS(MdbDataSource.EPAY)
public class QpSignService extends SuperService<QpSignMapper, QpSign> {

    public QpSign get(String customerCode, String bankAccNo) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<QpSign>()
                .eq(QpSign::getCustomerCode, customerCode)
                .eq(QpSign::getBankAccNo, bankAccNo));
    }

    public Integer countByStatus(String customerCode, String coreClientNo, String status) {
        return this.baseMapper.selectCount(new LambdaQueryWrapper<QpSign>()
                .eq(QpSign::getCustomerCode, customerCode)
                .eq(QpSign::getCoreClientNo, coreClientNo)
                .eq(QpSign::getStatus, status));
    }

    public QpSign getBySignNo(String customerCode, String signNo) {
        return this.baseMapper.selectOne(new LambdaQueryWrapper<QpSign>()
                .eq(QpSign::getCustomerCode, customerCode)
                .eq(QpSign::getSignNo, signNo));
    }

}
